<template lang="">
    <div>
        <select v-model='form.name'>
            <option value='dian'>联系电话</option>
            <option value='dizhi'>邮箱地址</option>
        </select>
        <input v-model='form.num' :placeholder='placeholder' />
        <button @click='hanshu'></button>
        <!-- <button @click='hanshu()'></button> -->
        
    </div>
</template>
<script>


export default {
    data(){
      return {
          add:1,
          app:1,
          form:{
           name:'dian',
           num:''
          }
      }   
    },
    computed:{

       hanshu(){
           this.add++;
           console.log(this.add);
           
       },
              placeholder(){
                if(this.form.name === 'dian') {
                        return '请输入电话' 
                }  
                if(this.form.name === 'dizhi') {
                       return '请输入邮箱地址'
                }  
                   
              
    }
},
methods:{
     hanshu(){
           this.app++;
           console.log(this.app);
            
       }
},
watch:{
   'form.name': function( val ) {
    console.log(val);
    
              this.form.num=val=''
    }
},

}
</script>
<style lang="">
    
</style>